package 蓝桥.十五届;

import java.util.*;

/**
 * @author ZhuYi
 * @create 2025/4/7 21:51
 */
public class F星际旅行 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int q = sc.nextInt();

        //创建一个星球列表
        ArrayList<Star> stars = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            Star star = new Star();
            star.index = i;
            stars.add(star);
        }

        //读取传送门信息，传入每个星球可到达的列表
        while (m-- != 0) {
            int ai = sc.nextInt() - 1;
            int bi = sc.nextInt() - 1;
            stars.get(ai).goList.add(stars.get(bi));
            stars.get(bi).goList.add(stars.get(ai));
        }

        //构建距离邻接表
        int[][] dist = new int[n][n];
        for (int i = 0; i < n; i++) {
            //都填充为-1,表示没有访问过
            Arrays.fill(dist[i], -1);
        }
        for (int i = 0; i < n; i++) {
            Queue<Integer> queue = new LinkedList<>();
            queue.add(i);
            //星球到自己的距离为0
            dist[i][i] = 0;
            while (!queue.isEmpty()) {
                int u = queue.poll();
                for (Star v : stars.get(i).goList) {
                    if (dist[i][v.index] == -1) {
                        dist[i][v.index] = dist[i][u] + 1;
                        queue.add(v.index);
                    }
                }
            }
        }
        float allStarSum = 0;
        float starSum = 0;
        for (int i = 0; i < q; i++) {
            starSum = 0;
            int xi = sc.nextInt() - 1;
            int yi = sc.nextInt();
            for (int j = 0; j < n; j++) {
                if (dist[xi][j] <= yi && dist[xi][j] != -1) {
                    starSum++;
                }
            }
            allStarSum += starSum;
        }
        float endSum = allStarSum / q;
        System.out.printf("%.2f", endSum);
        //没通过（/(ㄒoㄒ)/~~）
    }

    static class Star {
        int index;
        ArrayList<Star> goList = new ArrayList<>();
    }
}


